/**
 * 入口类
 * Created by zhd on 2017/6/23.
 */
var g_winWidth = 750, g_winHeight = 1206;
var gameLayer = null;
var GameScene = cc.Scene.extend({
    onEnter: function () {
        this._super();
        gameLayer = new GameLayer();
        this.addChild(gameLayer);
    }
});

var GameLayer = cc.LayerColor.extend({
    _turretSprite: null,
    _mapLayer: null,

    onEnter: function () {
        this._super();
        this.initGameLayer();
    },
    ctor: function () {
        this._super(cc.color(255, 255, 255, 255));
        cc.spriteFrameCache.addSpriteFrames(res.turret_1_plist, res.turret_1_png);
        cc.spriteFrameCache.addSpriteFrames(res.gameObj_plist, res.gameObj_png);
    },

    /**
     * 游戏初始化
     */
    initGameLayer: function () {
        this.loadTurretSprite();
        this.loadMapLayer();
        this.loadBallManageLayer();
    },

    /**
     * 加载炮台
     */
    loadTurretSprite: function () {
        this._turretSprite = new TurretSprite();
        this.addChild(this._turretSprite);
    },

    /**
     * 加载地图
     */
    loadMapLayer: function () {
        this._mapLayer = new MapLayer();
        this.addChild(this._mapLayer);
    },

    /**
     * 加载球管理类
     */
    loadBallManageLayer: function () {
        this._ballManageLayer = new BallManageLayer();
        this.addChild(this._ballManageLayer);
    }

});
